package com.itheima.health.jobs;


import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.health.service.OrderSettingService;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
import java.util.Date;


/**
 * @Author mhr
 * @Date 2020/4/17
 * @Version v1.0
 * @Description 定时清理预约设置表中的数据
 */
@Slf4j
public class ClearOrdersettingJob {

    //依赖注入service
    @Reference
    private OrderSettingService orderSettingService;

    /**
     * 清空垃圾预约设置数据的方法
     */
    public void clear(){
        System.out.println("clearOrdersettingJob.....");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String today = sdf.format(new Date());
        orderSettingService.clearOrdersettingData(today);
    }
}
